/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package consumo.entity;

import java.io.Serializable;
import java.math.BigDecimal;
import java.util.List;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;

/**
 *
 * @author Carlos Taschetto
 */
@Entity
@Table(name = "tipo_uso", catalog = "consumodb", schema = "")
@NamedQueries({
    @NamedQuery(name = "TipoUso.findAll", query = "SELECT t FROM TipoUso t"),
    @NamedQuery(name = "TipoUso.findById", query = "SELECT t FROM TipoUso t WHERE t.id = :id"),
    @NamedQuery(name = "TipoUso.findByDescricao", query = "SELECT t FROM TipoUso t WHERE t.descricao = :descricao"),
    @NamedQuery(name = "TipoUso.findByDesconto", query = "SELECT t FROM TipoUso t WHERE t.desconto = :desconto"),
    @NamedQuery(name = "TipoUso.findByDescontoSegundoPosto", query = "SELECT t FROM TipoUso t WHERE t.descontoSegundoPosto = :descontoSegundoPosto")})
public class TipoUso implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "id", nullable = false)
    private Integer id;
    @Column(name = "descricao", length = 45)
    private String descricao;
    @Column(name = "desconto", precision = 2, scale = 2)
    private BigDecimal desconto;
    @Column(name = "desconto_segundo_posto", precision = 2, scale = 2)
    private BigDecimal descontoSegundoPosto;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "tipoUso")
    private List<Contrato> contratoList;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "tipoUso")
    private List<Icms> icmsList;

    public TipoUso() {
    }

    public TipoUso(Integer id) {
        this.id = id;
    }

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public String getDescricao() {
        return descricao;
    }

    public void setDescricao(String descricao) {
        this.descricao = descricao;
    }

    public BigDecimal getDesconto() {
        return desconto;
    }

    public void setDesconto(BigDecimal desconto) {
        this.desconto = desconto;
    }

    public BigDecimal getDescontoSegundoPosto() {
        return descontoSegundoPosto;
    }

    public void setDescontoSegundoPosto(BigDecimal descontoSegundoPosto) {
        this.descontoSegundoPosto = descontoSegundoPosto;
    }

    public List<Contrato> getContratoList() {
        return contratoList;
    }

    public void setContratoList(List<Contrato> contratoList) {
        this.contratoList = contratoList;
    }

    public List<Icms> getIcmsList() {
        return icmsList;
    }

    public void setIcmsList(List<Icms> icmsList) {
        this.icmsList = icmsList;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (id != null ? id.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof TipoUso)) {
            return false;
        }
        TipoUso other = (TipoUso) object;
        if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return descricao;
    }

}
